package cn.itsource.basic.controller;

import cn.itsource.basic.base.domain.RegisterDto;
import cn.itsource.basic.base.service.IVerifyCodeService;
import cn.itsource.basic.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/verify")
public class VerifyCodeController {

    @Autowired
    private IVerifyCodeService verifyCodeService;

    @GetMapping("/img/{uuid}")
    public AjaxResult imgCode(@PathVariable String uuid){
        return verifyCodeService.imgCode(uuid);
    }

    @PostMapping("/smscode")
    public AjaxResult sendSmsCode(@RequestBody @Valid RegisterDto dto){
        return verifyCodeService.sendSmsCode(dto);
    }

}
